import { observable, action } from 'mobx';
import BaseListStore from '../BaseListStore';
import * as Apis from '../../apis/ReportApi';
import { WeaLocaleProvider } from 'ecCom';

const getLabel = WeaLocaleProvider.getLabel;

class ReportStore extends BaseListStore {
    @observable contractDialogTile = getLabel(16587, '合同列表');
    @observable contractDialogShow = false;
    @observable contractDialogParams = {};
    @observable dialog = { title: getLabel(20323, '客户信息'), visible: false, url: '', style: { width: 1000, height: 600 } };

    @action
    showCustomersDialog=(url) => {
      this.dialog.visible = true;
      this.dialog.url = url;
    }

    @action
    hideCustomersDialog=() => {
      this.dialog.visible = false;
    }

    @action
    showContractDialog=(bool = false, obj = {}) => {
      this.contractDialogShow = bool;
      this.contractDialogParams = obj;
    }

    getTableData(requestParams, callBackFn) {
      const type = this.routerParams.type;
      Apis.getContractReport(type, requestParams).then((data) => {
        callBackFn(data);
      });
    }

    excelExport(excelExportCallBack) {
      const type = this.routerParams.type;
      const requestParams = {};
      Apis.getContractReportExcel(type, requestParams).then((data) => {
        excelExportCallBack(data);
      });
    }
}

export default ReportStore;
